var login = {
    URL: {
        checkLoginUrl: "/api/userInfo/checkLogin",
        userLoginUrl: "/api/userInfo/login",
    },
    detail: {
        init: function () {
            $.post(login.URL.checkLoginUrl, {}, function (data) {
                $.pop.load(false, null);
                //未登陆
                if (data.hasError) {
                    winInit();
                } else {
                    var userInfo = data.object;
                    if (userInfo.regFlag == 0) {
                        window.location.href = "info.html";
                    } else {
                        window.location.href = "index.html";
                    }
                    //window.location.href = data.errUrl;
                }
            }, "json").error(function (XMLHttpRequest, textStatus, errorThrown) {
                $.pop.load(false, null);
                $.pop.tips("系统繁忙，请稍后" + XMLHttpRequest.status + "," + XMLHttpRequest.readyState + "," + textStatus);
            });
        },
        subBtn: function () {
            // var regNumber = $("[name='regNumber']").val();
            // var mobile = $("[name='mobile']").val();
            // if (!__DataVail.isMobile(mobile)) {
            //     $.pop.tips("请输入正确的手机号");
            //     return false;
            // }
            // if (__JsUtil.isNullOrEmpty(regNumber)) {
            //     $.pop.tips("请输入报名号");
            //     return false;
            // }
            var inviteCode = $("[name='inviteCode']").val();
            if (__JsUtil.isNullOrEmpty(inviteCode)){
                $.pop.tips("请输入邀请码");
                return false;
            }
            $.pop.load(true, "正在登录...");
            $.post(login.URL.userLoginUrl, {inviteCode: inviteCode}, function (data) {
                if (!data.hasError) {
                    var userInfo = data.object;
                    if (userInfo.regFlag == 0) {
                        window.location.href = "info.html";
                    } else {
                        window.location.href = "index.html";
                    }
                    //window.location.href = "index.html";
                } else {
                    $.pop.load(false, null);
                    $.pop.tips(data.error);
                }
            }, "json").error(function (XMLHttpRequest, textStatus, errorThrown) {
                $.pop.load(false, null);
                $.pop.tips("系统繁忙，请稍后" + XMLHttpRequest.status + "," + XMLHttpRequest.readyState + "," + textStatus);
            });
        }
    }
}